package cn.crm.controller;

import cn.crm.pojo.SalChance;
import cn.crm.service.SalChanceService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/SalChance")
public class SalChanceController {
    @Autowired
    private SalChanceService salChanceService;
    @GetMapping("/{id}")
    public SalChance getById(@PathVariable Integer id){
        return salChanceService.getById(id);
    }
    @PostMapping("/Page")
    public Page getPage(Page page){
        return salChanceService.page(page);
    }
    @PostMapping
    public boolean save(@RequestBody SalChance salChance){
        return salChanceService.save(salChance);
    }
    @DeleteMapping("/{id}")
    public boolean deleteById(@PathVariable Integer id){
        return salChanceService.removeById(id);
    }
    @PutMapping
    public boolean update(@RequestBody SalChance salChance){
        return salChanceService.updateById(salChance);
    }
}
